import { decrypt } from './des';
import { paramDecrypt } from './rsa';
/**
 * 请求返回数据处理
 */
export const responseHandler = (res, needSecret) => {
  if (needSecret) {
    console.log(res,'怎么个回事')
    const originData = decrypt(res.data.data, '98fbffd1064a4355b8abaacb6fa96f94') || {};
    return new Promise((resolve, reject) => {
      resolve(JSON.parse(originData));
      // resolve(res.data)
    });
  } else {
    return new Promise((resolve, reject) => {
      resolve(res.data);
    });
  }
};


export const responseHandler_face = (res, needSecret) => {
  if (needSecret) {
    const originData = paramDecrypt(res.data);
    return new Promise((resolve, reject) => {
      resolve(originData);
      // resolve(res.data)
    });
  } else {
    return new Promise((resolve, reject) => {
      resolve(res.data);
    });
  }
};
